﻿@{
    Layout = "~/Views/Shared/_Form.cshtml";
}
@model Raffles.OA.Data.DictionaryDetail 
<form class="form-horizontal m" role="form">
    <div class="form-group">
        <label class="col-sm-3 control-label">字典类型<font class="red">*</font></label>
        <div class="col-sm-9">
            @Html.TextBoxFor(model => model.DicType, new { @class = "form-control required", @placeholder = "请输入字典类型", @readonly = "readonly"})
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-3 control-label">字典键<font class="red">*</font></label>
        <div class="col-sm-9">
            @Html.TextBoxFor(model => model.DicCode, new { @class = "form-control required", @placeholder = "请输入字典键" })
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-3 control-label">字典值<font class="red">*</font></label>
        <div class="col-sm-9">
            @Html.TextBoxFor(model => model.DicValue, new { @class = "form-control required", @placeholder = "请输入字典值"})
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-3 control-label">显示顺序<font class="red">*</font></label>
        <div class="col-sm-9">
            @Html.TextBoxFor(model => model.DisplayOrder, new { @class = "form-control required", @type = "number", @min = "0", @placeholder = "请输入显示顺序"})
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-3 control-label">字典描述</label>
        <div class="col-sm-9">
            @Html.TextAreaFor(model => model.Description, new { @class = "form-control", @placeholder = "请输入角色描述" })
        </div>
    </div>
</form> 
<script>
    var id = frame.request("id"); 
    var dicType = frame.request("dicType");
    $(function () {
        $('#DicType').val(dicType);
    });
    function saveForm() {
        if ($('form').validate().form()) {
            frame.ajax({
                url: '@Url.Content("/Manage/DictionaryDetail/SaveForm")',
                type: "post",
                data: $('form').formSerialize(),
                success: function (obj) {
                    if (obj.success) {
                        frame.msgSuccess(obj.message);
                        parent.searchGrid();
                        frame.closeDialog(); 
                    }
                    else {
                        frame.msgError(obj.message);
                    }
                }
            });
        }
    }
</script>